
//
//  HMComposeMenuButton.swift
//  MyWeibo
//
//  Created by apple on 16/4/25.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class HMComposeMenuButton: UIButton {
    
    //重写高亮属性
    override var highlighted:Bool{
        
        get{
            
            return false
        }
        set{
            
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
   private func setupUI(){
        
        //设置字体居中
        titleLabel?.textAlignment = .Center
        //设置图片加载类型
       imageView?.contentMode = .Center
  
    }


    //调用方法修改布局
    override func layoutSubviews() {
        super.layoutSubviews()
        
        //调整image的宽高  把图片设置成一个正方形
        self.imageView?.frame = CGRect(x: 0, y: 0, width: self.frame.width, height: self.frame.width)
        
        //调整label 设置到图片的底部
        self.titleLabel?.frame = CGRect(x: 0, y: self.frame.width, width: self.frame.width, height: self.frame.height - self.frame.width)
  
        
    }
}
